{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn.neighbors import KNeighborsClassifier\n",
    "from sklearn.tree import DecisionTreeClassifier\n",
    "from sklearn.datasets import make_classification\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.metrics import classification_report"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 载入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>density</th>\n",
       "      <th>sugar</th>\n",
       "      <th>good</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.697</td>\n",
       "      <td>0.460</td>\n",
       "      <td>是</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.774</td>\n",
       "      <td>0.376</td>\n",
       "      <td>是</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.634</td>\n",
       "      <td>0.264</td>\n",
       "      <td>是</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.608</td>\n",
       "      <td>0.318</td>\n",
       "      <td>是</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.556</td>\n",
       "      <td>0.215</td>\n",
       "      <td>是</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   density  sugar good\n",
       "0    0.697  0.460    是\n",
       "1    0.774  0.376    是\n",
       "2    0.634  0.264    是\n",
       "3    0.608  0.318    是\n",
       "4    0.556  0.215    是"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = pd.read_csv(\"../data/watermelon.csv\")\n",
    "data.columns = [\"id\", \"density\", \"sugar\", \"good\"]\n",
    "data = data[[\"density\", \"sugar\", \"good\"]]\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>density</th>\n",
       "      <th>sugar</th>\n",
       "      <th>good</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.697</td>\n",
       "      <td>0.460</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.774</td>\n",
       "      <td>0.376</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.634</td>\n",
       "      <td>0.264</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.608</td>\n",
       "      <td>0.318</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.556</td>\n",
       "      <td>0.215</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   density  sugar  good\n",
       "0    0.697  0.460     1\n",
       "1    0.774  0.376     1\n",
       "2    0.634  0.264     1\n",
       "3    0.608  0.318     1\n",
       "4    0.556  0.215     1"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['good'] = data['good'].apply(lambda x: 1 if x == '是' else 0)\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = data.values[:, :2]\n",
    "y = data.values[:, 2]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 决策边界"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def counterPlot(X, y, clf):\n",
    "    plot_colors = \"br\"\n",
    "    plot_step = 0.02\n",
    "    class_names = \"01\"\n",
    "\n",
    "    plt.figure(figsize=(10, 5))\n",
    "\n",
    "    # Plot the decision boundaries\n",
    "    x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1\n",
    "    y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1\n",
    "    xx, yy = np.meshgrid(np.arange(x_min, x_max, plot_step),\n",
    "                         np.arange(y_min, y_max, plot_step))\n",
    "\n",
    "    Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])\n",
    "    Z = Z.reshape(xx.shape)\n",
    "    cs = plt.contourf(xx, yy, Z, cmap=plt.cm.Paired)\n",
    "    plt.axis(\"tight\")\n",
    "    # Plot the training points\n",
    "    for i, n, c in zip(range(2), class_names, plot_colors):\n",
    "        idx = np.where(y == i)\n",
    "        plt.scatter(X[idx, 0], X[idx, 1],\n",
    "                    c=c, cmap=plt.cm.Paired,\n",
    "                    s=20, edgecolor='k',\n",
    "                    label=\"Class %s\" % n)\n",
    "    plt.xlim(x_min, x_max)\n",
    "    plt.ylim(y_min, y_max)\n",
    "    plt.legend(loc='upper right')\n",
    "    plt.xlabel('x')\n",
    "    plt.ylabel('y')\n",
    "    plt.title('Decision Boundary')\n",
    "    \n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### KNN的决策边界\n",
    "\n",
    "knn的边界不依赖与座标轴，即其边界可以是任意的，不用与座标轴平行。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "knn = KNeighborsClassifier(n_neighbors=3).fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAmkAAAFNCAYAAABbpPhvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3dfXyddX3/8dcnTQGlUErLbUrp0Dos2qEroNxZ0I5SsSgDRp0VRC1D7iYDFOUHwtQx3dwqIqMoE9i4sagQtNixQfEGQYoi2FItd20TKL21N9LSJvn+/jgn9bQkTdIk5/omfT0fjzw451xXrutzcnHSd77X9yZSSkiSJCkvNUUXIEmSpNczpEmSJGXIkCZJkpQhQ5okSVKGDGmSJEkZMqRJkiRlyJAmqU+IiPsj4sxO7LcuIg6qRk1FiYgXI+J9RdchqXfVFl2ApP4jIl4E9gGagGZgHnArMD2l1NKdY6eUTuzkfoO6c572VLy3ZmAT8Ajwdymlxb1xPkmyJU1ST/tASmk34EDgWuAzwLeLLanHfKAcAvcDXgGuK7ieLokI/zCX+hBDmqRekVJanVKqB/4GODMi3gYQETtH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mImA28AzCkVVcjUNnCMrz8Wlv7NERELTAYWFGd8tSODq9bSqnyGn0L+EoV6lL3deYzqcyklNZUPJ4ZEd+MiGEppR1pTU9vd/YR9cCZ5cdnAvduvUNEDImIncuPhwFHAfOqVqFaPQ6Miog/i4idgDMoXb9KldfzVODB5ISFRevwum3Vj2kS8EwV69P2qwc+Wh7l+S5gdUX3EWUqIvZt7asbEYdTyis73B+ztqT1DdcC342IjwMLgdMBImIs8HcppU8AbwVujIgWSv8zX5tSMqRVWUqpKSLOB2YBA4CbU0pzI+IaYE5KqR74NnBbRDxLqePsGcVVLOj0dbswIiYBTZSu21mFFazNIuIOYBwwLCIagKuAgQAppf8AZgITgWeBV4GPFVOpKnXiup0KnBsRTcB64Iwd8Y9ZVxyQJEnKkLc7JUmSMmRIkyRJypAhTZIkKUOGNEmSpAwZ0iRJkjJkSJMkScqQIU2SJClDhjRJ2oaIOKy8qPouEbFrRMyNiLcVXZek/s/JbCWpAxHxRWAX4A1AQ0rpnwouSdIOwJAmSR0or+f5OLABODKl1FxwSZJ2AN7ulKSODQUGAbtRalGTpF5nS5okdSAi6oE7gT8D9kspnV9wSZJ2ALVFFyBJOYuIjwKbUkq3R8QA4JGIOD6l9GDRtUnq32xJkyRJypB90iRJkjJkSJMkScqQIU2SJClDhjRJkqQMGdIkSZIyZEiTJEnKkCFNkiQpQ4Y0SZKkDP1/lesWZnmE3HoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "counterPlot(X, y, knn)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 决策树边界\n",
    "决策树的因其本身的性质，其边界是由一系列和座标轴平行的线段围成的。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "clf = DecisionTreeClassifier(random_state=0).fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAmkAAAFNCAYAAABbpPhvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3de5xVdb3/8dcHBiFNEQZBuWkaXbzwsw5qahJantBTkB71aOd4SQ0zb9XxnmF2MbtfzULleOkolpZNhXastCzTxDJU0CNeuIpc46IgM8P398fecDY4w8wwM3t9Z3g9H495sPZa31nrs/dy45v1Xd/1jZQSkiRJykuPoguQJEnS6xnSJEmSMmRIkyRJypAhTZIkKUOGNEmSpAwZ0iRJkjJkSJPUJUTEPRFxaivarY6IPatRU1Ei4sWIeF/RdUjqXDVFFyCp+4iIF4FBQAPQCMwAbgEmpZTWt2ffKaWjWtnuje05TnMq3lsjUA88BHwspTS3M44nSV5Jk9TRPphS2hHYHbgGuAS4sdiSOswHyyFwN+Bl4LsF19MmEeE/zKUuxJAmqVOklFaklOqAfwNOjYh9ASKid0R8LSLmRMTLEfGDiHjDht+LiPER8XhErIyI5yJibHn9AxFxZnn5zRHx+4hYERFLIuKOit9PEfHm8nLfiLglIhZHxOyIuCIiepS3nRYRfyzXsjwiXoiI1l6tWwvcCexdcdwtHeuzEfGjirZ7lOusqXhvn4+IP0XEqoj4n4gYUNH+5PI+l0bEpytriYgDI+LPEfGPiHgpIr4XEdtt9nmcExHPAs9GxLUR8fXN9lEXEZ9szXuXVD2GNEmdKqX0F2AecFh51TXAW4D9gTcDQ4CJUAoclLpHLwJ2BkYDLzax288D/wP0A4bS/BWt7wJ9gT2B9wCnAB+p2H4Q8AwwAPgKcGNEREvvKSK2pxQ+H27DsVry4XL7gcB2wIXlY+0NXAecDAwGaim95w0agU+W38PBwHuBj2+27w9Req97Azc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bwr+UuszsjYlh1SlM7tfbcKj8HR8TfI+KeiNin6GKKUFN0ASqJiN8Auzax6dOVL1JKKSKaG5K7e0ppfkTsCfwuIp5IKT3X0bVK26hfALenlF6LiLMoXQ09ouCapO7qr5T+n7Y6Io4G7qbUZb1NMaRlIqX0vua2RcTLEbFbSuml8mX6Rc3sY375z+cj4gHgHYAhrbrmA5VXWIaW1zXVZl5E1AB9gaXVKU/NaPG8pZQqz9ENwFeqUJfarzXfSWUmpbSyYnlqRHw/IgaklLalOT3t7uwi6oBTy8unAj/fvEFE9DHUhnYAAAHeSURBVIuI3uXlAcChwIyqVagNHgVGRMSbImI74ERK569S5fk8Dvhd8oGFRWvxvG12H9M4YGYV69PWqwNOKY/yfBewouL2EWUqInbdcK9uRBxIKa9sc/+Y9Upa13AN8OOIOAOYDZwAEBGjgI+llM4E3g78MCLWU/qP+ZqUkiGtylJKDRFxLvBroCcwOaX0VER8DpiWUqoDbgRujYhZlG6cPbG4igWtPm/nR8Q4oIHSeTutsIK1UUTcDowBBkTEPOBKoBdASukHwFTgaGAW8CrwkWIqVaVWnLfjgLMjogFYA5y4Lf5j1hkHJEmSMmR3pyRJUoYMaZIkSRkypEmSJGXIkCZJkpQhQ5okSVKGDGmSJEkZMqRJkiRlyJAmSVsQEQeUJ1XvExE7RMRTEbFv0XVJ6v58mK0ktSAivgD0Ad4AzEspfangkiRtAwxpktSC8nyejwJrgUNSSo0FlyRpG2B3pyS1rBZ4I7AjpStqktTpvJImSS2IiDpgCvAmYLeU0rkFlyRpG1BTdAGSlLOIOAWoTyndFhE9gYci4oiU0u+Krk1S9+aVNEmSpAx5T5okSVKGDGmSJEkZMqRJkiRlyJAmSZKUIUOaJElShgxpkiRJGTKkSZIkZciQJkmSlKH/D48XexadpWeiAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 720x360 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "counterPlot(X, y, clf)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ML",
   "language": "python",
   "name": "ml"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
